﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package de.polygonal.ds {

    public class DListIterator implements Iterator {

        public var node:DListNode;
        public var list:DLinkedList;

        public function DListIterator(_arg1:DLinkedList, _arg2:DListNode=null){
            this.list = _arg1;
            this.node = _arg2;
        }
        public function start():void{
            this.node = this.list.head;
        }
        public function next(){
            var _local1:*;
            if (this.hasNext()){
                _local1 = this.node.data;
                this.node = this.node.next;
                return (_local1);
            };
            return (null);
        }
        public function hasNext():Boolean{
            return (Boolean(this.node));
        }
        public function get data(){
            if (this.node){
                return (this.node.data);
            };
            return (null);
        }
        public function set data(_arg1):void{
            this.node.data = _arg1;
        }
        public function end():void{
            this.node = this.list.tail;
        }
        public function forth():void{
            if (this.node){
                this.node = this.node.next;
            };
        }
        public function back():void{
            if (this.node){
                this.node = this.node.prev;
            };
        }
        public function valid():Boolean{
            return (Boolean(this.node));
        }
        public function remove():Boolean{
            return (this.list.remove(this));
        }
        public function toString():String{
            return ((("{DListIterator, data=" + (this.node) ? this.node.data : "null") + "}"));
        }

    }
}//package de.polygonal.ds 
